<?php if($this->act != 'modi'): ?>
<div class="t_2">
     <div class="fl">收货地址列表</div>
     <div class="fr add_form"><a href="javascript:;" id="add_table"></a></div>
</div>
<div class="order_show" id="info_form">
     <table width="100%" cellpadding="0" cellspacing="0" border="0" class="table1" >
     		 <tr>
           		<th class="th1" >内容</th>
            	<th class="th1">操作</th>
            </tr>
			<?php foreach((array)$this->rows as $item): ?>
			<tr>
				<td style="text-align:left"><?=$item['receive_name']?>，<?=$item['address']?>，<?=$item['zip']?>，<?=$item['tel']?></td>
				<td><a href="javascript:;" rel="del" label="<?=$item['cr_id']?>">删除</a> | <a href="javascript:;" onclick="window.location.href='<?=$_SERVER['REQUEST_URI']?>&act=modi&cr_id=<?=$item['cr_id']?>'">修改</a></td>
			</tr>
			<?php endforeach; ?>
     </table>
</div>
<div class="line_1"></div>
<?php endif; ?>
<div class="t_2">
     <div class="fl"><?=($this->act=='modi'?'修改':'添加')?>收货地址信息</div>
     <div class="fr add_form"><a href="javascript:;" id="add_table"></a></div>
</div>
<div class="order_show" id="info_form">
     <form id="post_form">
     <table width="100%" cellpadding="0" cellspacing="0" border="0" class="info_table">
            <tr>
                <td class="td1" width="15%">收货人姓名：</td>
                <td><input type="text" name="receive_name" value="<?=$this->cr['receive_name']?>"/></td>
            </tr>
            <tr>
                <td class="td1" width="15%">联系电话：</td>
                <td><input type="text" name="tel" value="<?=$this->cr['tel']?>"/></td>
            </tr>
            <tr>
                <td class="td1" width="15%">邮编：</td>
                <td><input type="text" name="zip" value="<?=$this->cr['zip']?>"/></td>
            </tr>
            <tr>
                <td class="td1" width="15%">地址：</td>
                <td>
					<p id="cselector">
						<select>
							<option>请选择</option>
							<?php foreach((array)$this->regions as $region): ?>
							<option value="<?=$region['class_id']?>"><?=$region['class_name']?></option>
							<?php endforeach; ?>
						</select>
					</p>
					<input type="text" id="object_show" name="address" style="width:300px" value="<?=$this->cr['address']?>"/>
				</td>
            </tr>
            <tr>
                <td class="td1" colspan="2" style="text-align:center">
					<input type="submit" value="提交" />
					<input type="hidden" name="act" value="<?=$this->act=='modi'?'modi':'add'?>"/>
					<input type="hidden" id="object_id"/>
					<input type="hidden" id="cselector_type" value="region"/>
				</td>
            </tr>
	</table>
	</form>
</div>
<script>
$(function(){
	$('#post_form').submit(function(){
		$.post(location.href,$(this).serialize(),function(data){
			alert(data.message);
			if (data.state == 1)
			{
				window.location.href='?app=customer&mod=address&customer_id=<?=$_GET['customer_id']?>';
			}
		},'json');
		return false;
	});
	$('a[rel=del]').click(function(){
		if (confirm('确定删除？'))
		{
			$.post(location.href,{act:'del',cr_id:$(this).attr('label')},function(data){
				alert(data.message);
				window.location.reload();
			},'json');
		}
	});
	cselectorInit('cselector');
});
</script>
     